package com.jie.langlangmall.portal.service;

import com.jie.langlangmall.common.api.CommonPage;
import com.jie.langlangmall.portal.domain.ConfirmOrderResult;
import com.jie.langlangmall.portal.domain.OmsOrderDetail;
import com.jie.langlangmall.portal.domain.OrderParam;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @Author Jie
 * @Date 2024/11/27
 * @Email 3217998214@qq.com
 * @Description 订单
 */
public interface OmsPortalOrderService {

    /**
     * 生成订单
     * @param orderParam
     * @return
     */
    Map<String, Object> generateOrder(OrderParam orderParam);

    /**
     * 发送取消订单的延迟消息
     * @param orderId
     */
    void sendDelayMessageCancelOrder(Long orderId);

    /**
     * 生成确认订单信息
     * @param cartIds
     * @return
     */
    ConfirmOrderResult generateConfirmOrder(List<Long> cartIds);

    /**
     * 取消超时的订单
     * @param orderId
     */
    void cancelOrder(Long orderId);

    /**
     * 获取订单列表
     * @param status
     * @param pageNum
     * @param pageSize
     * @return
     */
    CommonPage<OmsOrderDetail> list(Integer status, Integer pageNum, Integer pageSize);

    /**
     * 取消超时订单
     */
    @Transactional
    void cancelTimeOutOrder();

    /**
     * 获取订单详情
     * @param orderId
     * @return
     */
    OmsOrderDetail detail(Long orderId);

    /**
     * 确认收货
     * @param orderId
     */
    void confirmReceiveOrder(Long orderId);

    /**
     * 删除订单
     * @param orderId
     */
    void deleteOrder(Long orderId);

    /**
     * 支付成功的回调函数
     * @param orderId
     * @param payType
     */
    @Transactional
    void paySuccess(Long orderId, Integer payType);
}
